package com.dna.service.impl;

import com.dna.entity.ItemMaterialEntity;
import com.dna.entity.ItemSortEntity;
import com.dna.mapper.ItemMaterialMapper;
import com.dna.mapper.ItemSortMapper;
import com.dna.service.ItemMaterialService;
import com.dna.service.ItemSortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class ItemMaterialServiceImpl implements ItemMaterialService {

    @Autowired
    private ItemMaterialMapper itemMaterialMapper;

    @Override
    public List<ItemMaterialEntity> queryAll() {
        List<ItemMaterialEntity> deptList = itemMaterialMapper.selectAll();
        
        return deptList;
    }

    @Override
    public ItemMaterialEntity queryOne(ItemMaterialEntity dep) {
        return itemMaterialMapper.selectOne(dep);
    }

    @Override
    @Transactional
    public void save(ItemMaterialEntity dep) {
        itemMaterialMapper.insertSelective(dep);

    }

    @Override
    @Transactional
    public void update(ItemMaterialEntity dep) {
        itemMaterialMapper.updateByPrimaryKeySelective(dep);
    }

    @Override
    public void delete(ItemMaterialEntity itemMaterial, Example example) {
        itemMaterialMapper.updateByExampleSelective(itemMaterial, example);
    }

}
